package com.chonglie.listview;

import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.chonglie.R;

public class ItemViewHandler {

	private LayoutInflater inflater;

	public ItemViewHandler(LayoutInflater inflater) {
		super();
		this.inflater = inflater;
	}

	public View makeItemView(Item item) {
		View view = inflater.inflate(R.layout.list_view_item, null);
		TextView title = (TextView) view.findViewById(R.id.listview_item_title);
		title.setText(item.getTitle());
		TextView content = (TextView) view
				.findViewById(R.id.listview_item_content);
		content.setText(item.getContent());
		ImageView image = (ImageView) view
				.findViewById(R.id.listview_item_image);
		image.setImageResource(item.getImage());
		return view;
	}
}
